<!doctype html><html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
        <div class="datalist"><table id="flexigrid" style="display:none"></table></div>
        <script type="text/javascript">
            $(function() {
                $("#flexigrid").flexigrid($.extend(SG.flexOptions, {
                    url: '<?= site_url('broadcast/broadcastmamage/flexigrid') ?>',
                    colModel: [
                        {display: '<?= translate('ID') ?>', name: 'id', width: 100,iskey: true},
                        {display: '<?= translate('AREANAME') ?>', name: 'area', width: 120,},
                        {display: '<?= translate('BROADCAST_MSG') ?>', name: 'content', width: 400},
                        {display: '<?= translate('BROADCAST_COUNT') ?>', name: 'repeatCount', width: 150},
                        {display: '<?= translate('BROADCAST_INTERVAL') ?>', name: 'interval', width: 80},
                        {display: '<?= translate('BROADCAST_CHANNEL') ?>', name: 'channel', width: 300},
                        {display: '<?= translate('STATUS') ?>', name: 'state', width: '40', process: formatCronState},
                        {display: '<?= translate('BROADCAST_EXECUTE_TIME') ?>', name: 'executetime', width: 150},
                        {display: '<?= translate('FREQUENCE') ?>', name: 'frequence', width: 80},
                        {display: '<?= translate('MANAGE') ?>', name: 'id', width: 135, sortable: false, process: formatOp, toggle: false},
                    ],
                    buttons: [
                        {name: 'add', displayname: "<?= translate('ADD') ?>", title: "<?= translate('ADD') ?>", bclass: 'add', onpress: multi},
                        {name: 'delete', displayname: "<?= translate('DEL') ?>", title: "<?= translate('DEL') ?>", bclass: 'delete', onpress: multi},
                        {separator: true}
                    ],
                    searchitems: true,
                }));
                SG.admin = $.extend(SG.admin, {
                    add_url: '<?= site_url("broadcast/broadcastmamage/add") ?>',
                    edit_url: '<?= site_url("broadcast/broadcastmamage/edit/") ?>',
                    del_url: '<?= site_url("broadcast/broadcastmamage/del/") ?>',
                    multi_url: '<?= site_url("broadcast/broadcastmamage/multi/") ?>'
                });

                function formatCronState(value, id, cell, field) {
                    var arr = [, {
                            color: 'green',
                            text: '<?= translate('END') ?>',
                            value: 2
                        }, {
                            color: 'orange',
                            text: '<?= translate('RUNNING') ?>',
                            value: 1
                        }, {
                            color: 'purple',
                            text: '<?= translate('WAITING') ?>',
                            value: 0
                        }, {
                            color: 'gray',
                            text: '<?= translate('EXPIRE') ?>',
                            value: -1
                        }];
                    return filterGeneral(arr, value, field);
                }
            });
            
            
        </script>       
    </body>
</html>